﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.
	'Private lvuncomplete As clsCustomListView
'	Private itemkcshangmenaddr As Label
'	Private itemkcstatus As Label
'	Private itemkcteacherheader As RIV
'	Private itemkcteachername As Label
'	Private itemkcteachersex As ImageView
'	Private itemkctime As Label
'	Private lbltime As Label
	Private ulv As UltimateListView
	Private lstData As List
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("layuncompletekc")
	initviews
End Sub
Sub initviews
	Dim nH As Int=115dip
	comm.setFA(btnleft,"fa-angle-left","")
	ulv.AddLayout("itemkechenguncomplete","ui_LayoutCreator","unkc_ContentFiller",nH,True)
	Dim cd As ColorDrawable
	cd.Initialize(0xFFEFEFEF,0)
	ulv.DividerDrawable=cd
	ulv.DividerHeight=1dip
	comm.aio(Activity)
	reqUncompleteKC
End Sub
Private Sub reqUncompleteKC
	comm.showProgress("正在获取未完成课程列表信息")
	lstData.Initialize
	ParseHelper.doGetReq(Me,"requnkc",comm.getApi(comm.apiIdx.REQUNCOMPLETEKC),Null)
End Sub
Sub parseKC(str As String)
	lstData.Clear
	ulv.ClearContent
	DateTime.DateFormat="yyyy-MM-dd"
	Dim parser As JSONParser 
	parser.Initialize(str) 
	Dim root As Map = parser.NextObject 
	Dim data As List = root.Get("data") 
	For Each coldata As Map In data 
		lstData.Add(coldata)
	Next 
	ulv.BulkAddItems(data.Size,"itemkechenguncomplete",0)
		'Log("add banke")
End Sub
Sub ulv_EmptyView(LayoutPanel As Panel)
	LayoutPanel.LoadLayout("itemempty")
End Sub
Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		Select thj.JobName
		Case "requnkc"
			If nr.nCode=200 Then
				parseKC(str)
			Else
				comm.TL("错误:"&nr.sData)
			End If
		End Select
	Else
		comm.TL("网络错误:"&thj.ErrorMessage)
	End If
	thj.Release
End Sub
Sub unkc_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
	Dim coldata As Map=lstData.Get(ItemID)
	Dim image As String = coldata.Get("image") 
    Dim sd_start_time As String = coldata.Get("sd_start_time") 
'    Dim finished_time As String = coldata.Get("finished_time") 
    Dim kc_title As String = coldata.Get("kc_title") 
'    Dim tuikuan_time As String = coldata.Get("tuikuan_time") 
    Dim sex As String = coldata.Get("sex") 
'    Dim usertel As String = coldata.Get("usertel") 
'    Dim sd_mode As String = coldata.Get("sd_mode") 
'    Dim sd_hour As String = coldata.Get("sd_hour") 
'    Dim trd_id As String = coldata.Get("trd_id") 
'    Dim sd_money As String = coldata.Get("sd_money") 
'    Dim sd_end_time As String = coldata.Get("sd_end_time") 
    Dim fl_title As String = coldata.Get("fl_title") 
    Dim riqi As String = coldata.Get("riqi") 
'    Dim id As String = coldata.Get("id") 
    Dim kc_address As String = coldata.Get("kc_address") 
'    Dim add_time As String = coldata.Get("add_time") 
'    Dim order_sn As String = coldata.Get("order_sn") 
    Dim status As String = coldata.Get("status") 
    Dim username As String = coldata.Get("username") 
'    Dim jsaddress As String = coldata.Get("jsaddress") 
	Dim tp As Panel=LayoutPanel.GetView(0)

	Dim riv As ImageView=tp.GetView(2)
	comm.loadimground(comm.combinPic(image),riv,0,0)
	Dim labtime As Label=tp.GetView(0)
	labtime.Text=sd_start_time
	Dim lblkcstatus As Label=tp.GetView(1)
	lblkcstatus.Text=status
	Dim lblname As Label=tp.GetView(5)
	lblname.Text=fl_title&" "&kc_title&" "& username
	lblname.Text=lblname.Text.Trim
	comm.setViewWrapContent(lblname)
	Dim ivsex As ImageView=tp.GetView(6)
	If sex.EqualsIgnoreCase("1") Then
		ivsex.Bitmap=comm.bmpSexMan
		comm.setivsexsize(ivsex,True)
	Else
		ivsex.Bitmap=comm.bmpSexWoman
		comm.setivsexsize(ivsex,False)
	End If
	ivsex.Left=lblname.Left+lblname.Width+5dip
	Dim lbladdr As Label=tp.GetView(3)
	lbladdr.Text=kc_address
	Dim lbltime As Label=tp.GetView(4)
	lbltime.Text="上课日期："&riqi
End Sub
Sub ui_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
	LayoutPanel.LoadLayout(LayoutName)
End Sub
Sub ulv_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
	Dim m As Map=lstData.Get(ItemID)
	Dim curkc As kcItem
	curkc.Initialize
	curkc.shiduanlst.Initialize
	curkc.trdid=m.Get("trd_id") 
	g_store.put("curkc",curkc)
	StartActivity(actKcDetail)'课程详情只要trd_id
	
End Sub
'Private Sub CreateKCItem_Uncomplete(w As Int,h As Int) As Panel
'	Dim p As Panel
'	p.Initialize("")
'	Activity.AddView(p,0,0,w,h)
'	p.LoadLayout("itemkechenguncomplete")
'	comm.loadimg(comm.S_TESTTEACHERHEADER,itemkcteacherheader)
'	Dim n As Int=comm.su.MeasureMultilineTextHeight(itemkcteachername,itemkcteachername.Text)
'	n=n*(itemkcteachername.Text.Trim.Length-2)
'	itemkcteachername.Width=n
'	Log(n)
'	itemkcteachersex.Left=itemkcteachername.Left+itemkcteachername.Width
'	p.RemoveView
'	Return p
'End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ivback_Click
	Activity.Finish
End Sub